home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 4_0 / WDFTST__ / MAKE_WIN.C < prev    next >
C/C++ Source or Header  |  1990-06-10  |  2KB  |  59 lines

  1. #include <MacProto.h>
  2. #include <stdio.h>
  3.  
  4. #include "proto.h"
  5. #include "defines.h"
  6. #include "external_globals.h"
  7. #include "error_message.h"
  8.  
  9. /* ------------------------ Make_windows --------------------------- */
  10. /* Uses globals: g_app_pathnum,  g_checked_handle */
  11. void Make_windows()
  12. {
  13.     Rect    first_bounds, second_bounds;
  14.     Handle    the_handle;
  15.     int     proc_id;
  16.     int        checked_WDEF_id;
  17.     ResType        res_type;
  18.     Str255    res_name;
  19.     
  20.     UseResFile( g_app_pathnum );
  21.     
  22.     the_handle = GetResource( 'Rect', FIRST_RECT_ID );
  23.     first_bounds = *(Rect *)*the_handle;
  24.     the_handle = GetResource( 'Rect', SECOND_RECT_ID );
  25.     second_bounds = *(Rect *)*the_handle;
  26.     
  27.     g_first_pict = (PicHandle)GetResource( 'PICT', FIRST_PICT_ID );
  28.     g_second_pict = (PicHandle)GetResource( 'PICT', SECOND_PICT_ID );
  29.  
  30.     UseResFile( HomeResFile(g_checked_handle) );
  31.     if (ResError() != noErr) Warning( ResError() );
  32.     GetResInfo( g_checked_handle, &checked_WDEF_id, &res_type, res_name );
  33.     proc_id = (checked_WDEF_id << 4) | g_variation_code;
  34.  
  35.     g_first_window = NewWindow( nil, &first_bounds,
  36.         (char *)g_first_window_title, FALSE,
  37.         proc_id, (WindowPtr)MOVE_TO_FRONT, g_go_away, nil );
  38.     SetPort( g_first_window );
  39.     InvalRect( &g_first_window->portRect );
  40.     ShowWindow( g_first_window );
  41.  
  42.     g_second_window = NewWindow( nil, &second_bounds,
  43.          (char *)g_second_window_title, FALSE,
  44.         proc_id, (WindowPtr)MOVE_TO_FRONT, g_go_away, nil );
  45.     SetPort( g_second_window );
  46.     InvalRect( &g_second_window->portRect );
  47.     ShowWindow( g_second_window );
  48.  
  49.     UseResFile( g_app_pathnum );
  50. }
  51.  
  52. /* ------------------- Destroy_windows ----------------------- */
  53. void Destroy_windows()
  54. {
  55.     DisposeWindow( g_first_window );
  56.     DisposeWindow( g_second_window );
  57. }
  58.  
  59.